namespace ZFramework.Runtime
{
    public interface IEntity
    {
        //实体编号
        int Id { get; }

        //资源路径
        string EntityPath { get; }

        //获取实体实例
        object Obj { get; }

        IEntityGroup EntityGroup { get; }

        void OnInit(int entityId, string entityPath, IEntityGroup entityGroup, bool isNewInstance, object userData);

        void OnRecycle();

        void OnShow(object userData);

        void OnHide(object userData);

        //添加子实体
        void OnAttached(IEntity childEntity, object userData);

        //解除子实体
        void OnDetached(IEntity childEntity, object userData);

        //被添加到父实体
        void OnAttachTo(IEntity parentEntity, object userData);

        //被解除父实体
        void OnDetachFrom(IEntity parentEntity, object userData);

        void OnUpdate();
    }
}
